'use strict';

exports.create = async ctx => {
  ctx.validate({
    data: {
      type: 'string',
    },
  });
  const data = await ctx.service.cacheData.create(ctx.w_body().data);
  ctx.sendSuccess(data);
};

exports.show = async ctx => {
  ctx.validate({
    id: {
      type: 'mongo-id',
    },
  }, ctx.params);
  const data = await ctx.service.cacheData.getData(ctx.params.id);
  ctx.sendSuccess(data);
};
